<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>博客后台管理</title>
    <link rel="stylesheet" href="/public/css/bootstrap.css">
    <link rel="stylesheet" href="/public/css/admin.css">
    <script type="text/javascript" src="/public/js/jquery.js"></script>
    <script type="text/javascript" src="/public/js/bootstrap.js"></script>
    <script type="text/javascript" src="/public/js/admin.js"></script>
</head>

<body>
    {% if userInfo.Isadmin %}
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/admin">后台管理</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="/admin/user">用户信息</a></li>
                    <li><a href="/admin/category">所有分类</a></li>
                    <li><a href="/admin/category/add">添加分类</a></li>
                    <li><a href="/admin/content">所有博文</a></li>
                    <li><a href="/admin/content/add">添加博文</a></li>
                </ul>

                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                            aria-expanded="false">{{userInfo.username}}<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="/">退出管理</a></li>
                        </ul>
                    </li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>

    {% block main %}
    {% endblock %}

    {% else %}
    <div class="jumbotron">
        <h1>分享自己的精彩吧！</h1>BLOG</h1>
        <p>如果你想进行后台管理，请联系本站的管理员，谢谢！</p>
        <p><a class="btn btn-primary btn-lg" href="/" role="button">返回主页</a></p>
        <form role="form" method="post" style="font-size: 22px;text-align: center" action="/admin/content/specialadd">
            <div class="form-group">
                <label for="name">博文标题</label>
                <input type="text" class="form-control" name="name" id="name" placeholder="请填写博文名称">
            </div>
            <div class="form-group">
                <label for="category">请选择分类</label>
                <select name="category" id="category" class="form-control">
                    {% for category in categories %}
                    <option value="{{category.Name}}">{{category.Name}}</option>
                    {% endfor %}

                </select>

                <div class="form-group" style="margin-top: 20px;font-size: 20px;">
                    <label for="description">请填写简介</label>
                    <textarea name="description" id="description" class="form-control" rows="4" placeholder="请输入内容简介"
                        style="overflow: auto;"></textarea>
                </div>

                <div class="form-group" style="margin-top: 20px;font-size: 20px;">
                    <label for="content">请填写正文</label>
                    <textarea name="content" id="content" class="form-control" rows="15" placeholder="请输入内容"></textarea>
                </div>

            </div>
            <button type="submit" class="btn btn-primary btn-lg" style="margin-top: 50px;">新增博文</button>
        </form>
    </div>
    {% endif %}
</body>

</html>